package uz.gov.test;

import com.core.selenium.WebDriverFactory;
import com.core.util.PropertyLoader;
import com.core.util.ReportWriter;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;

import java.util.concurrent.TimeUnit;

/**
 * Created by IIGalytska on 04.04.14.
 */
public class PrePostConditions {
    WebDriver driver;

    @BeforeSuite
    public void initEnv()
    {
        ReportWriter.info("Init driver");
        WebDriverFactory factory = new WebDriverFactory();
        driver = factory.initDriver(PropertyLoader.loadProperty("browser.name"),factory.DEFAULT_PROFILE);
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);



    }


    @BeforeTest
   public void initPaga()
    {
            driver.get("http://rozetka.com.ua/");
            driver.manage().deleteAllCookies();
    }


    @AfterSuite
    public void clearEnv()
    {
        if (driver!=null)
            driver.quit();
    }

}
